/**
 * 
 */
package wong.board.client.resources;

import java.util.logging.Logger;

import wong.board.client.Resources;

/**
 * @author wong
 * 
 */
public abstract class AbstractResources implements Resources {
	protected static final Logger logger = Logger.getLogger(AbstractResources.class.getName());
	private BoardBundle bundle;

	protected abstract BoardBundle createBundle();

	@Override
	public final BoardBundle getBundle() {
		if (bundle == null) {
			bundle = createBundle();
			logger.config("BoardBundle created.");
			bundle.widgetsCss().ensureInjected();
			logger.config("BoardBundle widgetCss resource injected.");
			bundle.boardCss().ensureInjected();
			logger.config("BoardBundle boardCss resource injected.");
		}
		return bundle;
	}

}
